package com.easyidea.its.domain.model.surveillance;

import java.sql.Timestamp;
import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Transient;

import com.easyidea.its.domain.model.system.Department;
import com.easyidea.its.domain.model.system.User;

/**
 * 布控
 * 
 * @author kangning.hu
 * 
 */
@Entity
@Table(name = "surveillance")
public class Surveillance {

	private Integer surveillanceID;// 布控ID
	private String surveillanceType;// 布控类型
	private String plateNumber;// 布控车牌号码
	private String plateNumberReg;// 布控车牌号码 正则表达式
	private String plateType;// 布控车牌类型
	private String vehicleColor;// 车辆颜色
	private String vehicleBrand;// 布控车辆品牌
	private String vehicleCharacter;// 布控车辆特征
	private String contactWay;// 联系方式
	private Date startingDate;// 布控开始时间
	private Date expiringDate;// 布控结束时间
	private String treatmentMethod;// 处理方式
	private Department surveillancDept;// 布控部门代码
	private String remark;// 备注
	private String briefCase;// 简要案情
	private User surveillancUser;// 布控用户ID
	private boolean active = true;


	@Column(name = "plateNumberReg")
	public String getPlateNumberReg() {
		return plateNumberReg;
	}

	public void setPlateNumberReg(String plateNumberReg) {
		this.plateNumberReg = plateNumberReg;
	}

	@Id
	@Column(name = "surveillanceID")
	@GeneratedValue(strategy = GenerationType.AUTO)
	public Integer getId() {
		return surveillanceID;
	}

	@Column(name = "surveillanceType")
	public String getSurveillanceType() {
		return surveillanceType;
	}

	@Column(name = "plateNumber")
	public String getPlateNumber() {
		return plateNumber;
	}

	@Column(name = "plateType")
	public String getPlateType() {
		return plateType;
	}

	@Column(name = "vehicleColor")
	public String getVehicleColor() {
		return vehicleColor;
	}

	@Column(name = "vehicleBrand")
	public String getVehicleBrand() {
		return vehicleBrand;
	}

	@Column(name = "vehicleCharacter")
	public String getVehicleCharacter() {
		return vehicleCharacter;
	}

	@Column(name = "contactWay")
	public String getContactWay() {
		return contactWay;
	}

	@Column(name = "startingDate")
	public Date getStartingDate() {
		return startingDate;
	}

	@Column(name = "expiringDate")
	public Date getExpiringDate() {
		return expiringDate;
	}

	@Column(name = "treatmentMethod")
	public String getTreatmentMethod() {
		return treatmentMethod;
	}

	@Column(name = "remark")
	public String getRemark() {
		return remark;
	}

	@Column(name = "briefCase")
	public String getBriefCase() {
		return briefCase;
	}
	@Column(name = "is_active")
	public boolean isActive() {
		return active;
	}
	@OneToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
	@JoinColumn(name = "surveillancUserID", referencedColumnName = "id")
	public User getSurveillancUser() {
		return surveillancUser;
	}

	public void setId(Integer surveillanceID) {
		this.surveillanceID = surveillanceID;
	}

	public void setSurveillanceType(String surveillanceType) {
		this.surveillanceType = surveillanceType;
	}

	public void setPlateNumber(String plateNumber) {
		this.plateNumber = plateNumber;
	}

	public void setPlateType(String plateType) {
		this.plateType = plateType;
	}

	public void setVehicleColor(String vehicleColor) {
		this.vehicleColor = vehicleColor;
	}

	public void setVehicleBrand(String vehicleBrand) {
		this.vehicleBrand = vehicleBrand;
	}

	public void setVehicleCharacter(String vehicleCharacter) {
		this.vehicleCharacter = vehicleCharacter;
	}

	public void setContactWay(String contactWay) {
		this.contactWay = contactWay;
	}

	public void setStartingDate(Date startingDate) {
		this.startingDate = startingDate;
	}

	public void setExpiringDate(Date expiringDate) {
		this.expiringDate = expiringDate;
	}

	public void setTreatmentMethod(String treatmentMethod) {
		this.treatmentMethod = treatmentMethod;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public void setBriefCase(String briefCase) {
		this.briefCase = briefCase;
	}

	public void setSurveillancUser(User surveillancUser) {
		this.surveillancUser = surveillancUser;
	}

	@OneToOne(cascade = CascadeType.MERGE, fetch = FetchType.LAZY)
	@JoinColumn(name = "surveillancDeptCode", referencedColumnName = "id")
	public Department getSurveillancDept() {
		return surveillancDept;
	}

	public void setSurveillancDept(Department surveillancDept) {
		this.surveillancDept = surveillancDept;
	}


	public void setActive(boolean active) {
		this.active = active;
	}
	@Transient
	public String getSurveillanceTypeStr() {
		return "24小时内违法数据";
	}

	@Transient
	public String getPlateTypeStr() {
		if (this.getPlateType() != null) {
			if (this.getPlateType().equals("1"))
				return "普通小车，私家车";
			if (this.getPlateType().equals("2"))
				return "普通大车，卡车";
			if (this.getPlateType().equals("4"))
				return "警车";
			if (this.getPlateType().equals("8"))
				return "武警车辆";
			if (this.getPlateType().equals("16"))
				return "港澳车辆";
			if (this.getPlateType().equals("32"))
				return "双层黄牌";
			if (this.getPlateType().equals("64"))
				return "军牌";
			if (this.getPlateType().equals("512"))
				return "第二类警车";
			if (this.getPlateType().equals("1024"))
				return "\"学\"车牌";
			if (this.getPlateType().equals("2048"))
				return "摩托车";
		}
		return "未知";
	}
//	
//	private String plateNumberPrefix;
//	private String plateNumberSufix;
//
//	@Transient
//	public String getPlateNumberPrefix() {
//		return plateNumberPrefix;
//	}
//
//	public void setPlateNumberPrefix(String plateNumberPrefix) {
//		this.plateNumberPrefix = plateNumberPrefix;
//	}
//
//	@Transient
//	public String getPlateNumberSufix() {
//		return plateNumberSufix;
//	}
//
//	public void setPlateNumberSufix(String plateNumberSufix) {
//		
//		this.plateNumberSufix = plateNumberSufix;
//	}
	
}
